<include file='public/_meta'>

<div class="page-container">
	<form action="{:url('index/cars/attrAdd')}" method="post" class="form form-horizontal" id="form-type-add">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">
				<span class="c-red">*</span>
				属性名称：</label>
			<div class="formControls col-xs-6 col-sm-6">
				<input type="text" class="input-text" value="" placeholder="" id="user-name" name="attr_name">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">
				<span class="c-red">*</span>
				所属模型：</label>
			<div class="formControls col-xs-6 col-sm-6">
				<span class="select-box" style="width:150px;">
					<select class="select" name="type_id" size="1">
						<foreach name='type' item = 'value' key='k'>
							<option value="{$k}">{$value}</option>
						</foreach>
					</select>
				</span> 
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">
				<span class="c-red">*</span>
				录入方式：</label>
			<div class="formControls col-xs-8 col-sm-10">
	            <input type="radio" value="0" name="attr_input_type" checked="checked">手工录入
	            <input type="radio" value="1" name="attr_input_type">多行文本框           
	            <input type="radio" value="2" name="attr_input_type">从下面的列表中选择（一行代表一个可选值）
  
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">可选值列表：</label>
			<div class="formControls col-xs-6 col-sm-6">
				<textarea name="attr_values" cols="" rows="" class="textarea"  dragonfly="true" onKeyUp=""></textarea>
				<p class="c-success">录入方式为手工或者多行文本时，此输入框为默认值。</p>
			</div>
		</div>

		<div class="row cl">
			<div class="col-9 col-offset-2">
				<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;确认提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</div>

<!--_footer 作为公共模版分离出去-->
<include file='public/_footer'>
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本--> 
<script type="text/javascript" src="__PUBLIC__/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__PUBLIC__/lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="__PUBLIC__/lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="__PUBLIC__/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
$(function(){

	$("#form-type-add").validate({
		rules:{
			name:{
				required:true,
				maxlength:60
			},
			
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			$(form).ajaxSubmit({
				 success: function(data) { 
				 	var index = parent.layer.getFrameIndex(window.name);
					//parent.$('.btn-refresh').click();
                if(data['status']==0){
                
                	layer.msg(data['msg'], {icon:6,time:1000},function(){

						parent.location.href = '{:url('index/cars/attrList')}';              		
						parent.layer.close(index);
                	});

                }else{
                	layer.msg(data['msg']);

                }
            }


			});

		}
	});
});

</script> 
<!--/请在上方写此页面业务相关的脚本-->